#include "Thread.h"
#include "CountingSemaphore.h"
#include <stdio.h>

class MyThread : public Thread {
	void run() {
		while(1) {
//			ps->wait();

			(*pi)++;

			printf("%s thread a=%i i=%i\n", getName().c_str(), a, *pi);
			fflush(stdout);
//			ps->signal();
			
			sleep(1);
		}
	}

public:
	MyThread(ThreadPriority pri = Thread::PRIORITY_NORMAL, string _name = "")
		: Thread(pri, _name) {
	};

	int a;
	int* pi;
	CountingSemaphore* ps;

};
